home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / slock / slock.hpp < prev    next >
C/C++ Source or Header  |  1998-09-28  |  7KB  |  178 lines

  1. // Borland C++ Builder
  2. // Copyright (c) 1995, 1998 by Borland International
  3. // All rights reserved
  4.  
  5. // (DO NOT EDIT: machine generated header) 'Slock.pas' rev: 3.00
  6.  
  7. #ifndef SlockHPP
  8. #define SlockHPP
  9. #include <SlokUtil.hpp>
  10. #include <ExtCtrls.hpp>
  11. #include <Registry.hpp>
  12. #include <StdCtrls.hpp>
  13. #include <Dialogs.hpp>
  14. #include <Controls.hpp>
  15. #include <Graphics.hpp>
  16. #include <Classes.hpp>
  17. #include <SysUtils.hpp>
  18. #include <Messages.hpp>
  19. #include <Windows.hpp>
  20. #include <SysInit.hpp>
  21. #include <System.hpp>
  22.  
  23. //-- user supplied -----------------------------------------------------------
  24.  
  25. namespace Slock
  26. {
  27. //-- type declarations -------------------------------------------------------
  28. typedef char *PBuffer;
  29.  
  30. enum TProtectionType { ptNone, ptExpiryDate, ptStartCount, ptDayCount, ptDaysUsed, ptTimed };
  31.  
  32. enum TStatus { stNotExpired, stGrace, stExpired, stRegistered };
  33.  
  34. enum TMachineOptions { moWinProdId, moWinRegOrg, moWinRegOwner, moVolSerial, moVolLabel, moExtensions 
  35.     };
  36.  
  37. typedef Set<TMachineOptions, moWinProdId, moExtensions>  TMachineOpt;
  38.  
  39. enum TProtectionOptions { poBack, poDLL };
  40.  
  41. typedef Set<TProtectionOptions, poBack, poDLL>  TProtOpt;
  42.  
  43. enum TRegRoot { CURRENT_USER, CLASSES_ROOT, LOCAL_MACHINE, USERS, CURRENT_CONFIG, DYN_DATA };
  44.  
  45. struct TRegInfo
  46. {
  47.     System::AnsiString RegName;
  48.     System::AnsiString ChallString;
  49.     System::AnsiString RegCode;
  50.     int StartsLeft;
  51.     int GracePeriod;
  52.     int Extension;
  53.     System::TDateTime ExpiryDate;
  54.     System::TDateTime UpdateDate;
  55. } ;
  56.  
  57. class DELPHICLASS TSlock;
  58. class PASCALIMPLEMENTATION TSlock : public Classes::TComponent 
  59. {
  60.     typedef Classes::TComponent inherited;
  61.     
  62. private:
  63.     Registry::TRegistry* Reg;
  64.     Extctrls::TTimer* Timer;
  65.     TProtectionType FProtectionType;
  66.     TProtOpt FProtOpt;
  67.     TRegInfo FRegInfo;
  68.     TStatus FStatus;
  69.     TMachineOpt FMachineOpt;
  70.     TRegRoot FKeyMainRoot;
  71.     TRegRoot FKeyBackRoot;
  72.     System::AnsiString FKeyMainPath;
  73.     System::AnsiString FKeyBackPath;
  74.     System::AnsiString FKeyMainKey;
  75.     System::AnsiString FKeyBackKey;
  76.     System::AnsiString FEncKey;
  77.     System::AnsiString FDLLName;
  78.     bool FIsRegistered;
  79.     Classes::TNotifyEvent FFirstStart;
  80.     Classes::TNotifyEvent FClockMovedBack;
  81.     Classes::TNotifyEvent FRegInfoTamper;
  82.     Classes::TNotifyEvent FRegInfoChanged;
  83.     Classes::TNotifyEvent FWrongUnlockCode;
  84.     Classes::TNotifyEvent FReminder;
  85.     Classes::TNotifyEvent FExpired;
  86.     Classes::TNotifyEvent FRegister;
  87.     Classes::TNotifyEvent FInGracePeriod;
  88.     Classes::TNotifyEvent FRegWriteErr;
  89.     Classes::TNotifyEvent FExtend;
  90.     Classes::TNotifyEvent FTimedOut;
  91.     void __fastcall SetProtectionType(TProtectionType Value);
  92.     void __fastcall SetStatus(TStatus Value);
  93.     void __fastcall SetIsRegistered(bool Value);
  94.     void __fastcall SetRegName(System::AnsiString Value);
  95.     void __fastcall SetEncKey(System::AnsiString Value);
  96.     System::AnsiString __fastcall GetChallengeString(void);
  97.     int __fastcall CheckUnlockString(System::AnsiString UnlockToTest);
  98.     int __fastcall GetRegInfo(void);
  99.     void __fastcall PutRegInfo(void);
  100.     int __fastcall GetActionType(void);
  101.     bool __fastcall CompareInfoCopies(const TRegInfo &MainCopy, const TRegInfo &BackCopy);
  102.     bool __fastcall FindDLL(void);
  103.     void __fastcall ReadDLLData(Byte * Buffer);
  104.     void __fastcall WriteDLLData(const Byte * Buffer);
  105.     bool __fastcall ParseBuffer(const Byte * Buffer, TRegInfo &RegInfoCopy);
  106.     void __fastcall NagRegister(void);
  107.     void __fastcall TimedOut(System::TObject* Sender);
  108.     System::AnsiString __fastcall GetAppPath(void);
  109.     int __fastcall GetRoot(TRegRoot RootKey);
  110.     
  111. protected:
  112.     void __fastcall DoFirstStart(void);
  113.     void __fastcall DoClockMovedBack(void);
  114.     void __fastcall DoRegistryTamper(void);
  115.     void __fastcall DoRegInfoChanged(void);
  116.     void __fastcall DoWrongUnlockCode(void);
  117.     void __fastcall DoReminder(void);
  118.     void __fastcall DoExpired(void);
  119.     void __fastcall DoRegister(void);
  120.     void __fastcall DoInGracePeriod(void);
  121.     void __fastcall DoRegWriteErr(void);
  122.     void __fastcall DoExtend(void);
  123.     void __fastcall DoTimedOut(void);
  124.     
  125. public:
  126.     void __fastcall CheckProtection(void);
  127.     void __fastcall RegisterNow(System::AnsiString UnlockString);
  128.     void __fastcall DeleteRegInfo(void);
  129.     System::AnsiString __fastcall GetVersion(void);
  130.     __fastcall virtual TSlock(Classes::TComponent* aOwner);
  131.     __fastcall virtual ~TSlock(void);
  132.     
  133. __published:
  134.     __property System::AnsiString ChallengeString = {read=FRegInfo.ChallString, write=FRegInfo.ChallString
  135.         };
  136.     __property System::AnsiString DLLName = {read=FDLLName, write=FDLLName};
  137.     __property System::AnsiString EncryptionKey = {read=FEncKey, write=SetEncKey};
  138.     __property System::TDateTime ExpiryDate = {read=FRegInfo.ExpiryDate, write=FRegInfo.ExpiryDate};
  139.     __property int GracePeriod = {read=FRegInfo.GracePeriod, write=FRegInfo.GracePeriod, nodefault};
  140.     __property TMachineOpt MachineOptions = {read=FMachineOpt, write=FMachineOpt, nodefault};
  141.     __property TProtOpt ProtectionOpt = {read=FProtOpt, write=FProtOpt, nodefault};
  142.     __property TProtectionType ProtectionType = {read=FProtectionType, write=SetProtectionType, nodefault
  143.         };
  144.     __property bool Registered = {read=FIsRegistered, write=SetIsRegistered, nodefault};
  145.     __property TRegRoot RegKeyMainRoot = {read=FKeyMainRoot, write=FKeyMainRoot, nodefault};
  146.     __property TRegRoot RegKeyBackRoot = {read=FKeyBackRoot, write=FKeyBackRoot, nodefault};
  147.     __property System::AnsiString RegKeyMainPath = {read=FKeyMainPath, write=FKeyMainPath};
  148.     __property System::AnsiString RegKeyBackPath = {read=FKeyBackPath, write=FKeyBackPath};
  149.     __property System::AnsiString RegKeyMainKey = {read=FKeyMainKey, write=FKeyMainKey};
  150.     __property System::AnsiString RegKeyBackKey = {read=FKeyBackKey, write=FKeyBackKey};
  151.     __property System::AnsiString RegName = {read=FRegInfo.RegName, write=SetRegName};
  152.     __property TStatus Status = {read=FStatus, write=SetStatus, nodefault};
  153.     __property int TrialPeriod = {read=FRegInfo.StartsLeft, write=FRegInfo.StartsLeft, nodefault};
  154.     __property Classes::TNotifyEvent OnClockMovedBack = {read=FClockMovedBack, write=FClockMovedBack};
  155.     __property Classes::TNotifyEvent OnExpired = {read=FExpired, write=FExpired};
  156.     __property Classes::TNotifyEvent OnExtend = {read=FExtend, write=FExtend};
  157.     __property Classes::TNotifyEvent OnFirstStart = {read=FFirstStart, write=FFirstStart};
  158.     __property Classes::TNotifyEvent OnInGracePeriod = {read=FInGracePeriod, write=FInGracePeriod};
  159.     __property Classes::TNotifyEvent OnRegInfoTamper = {read=FRegInfoTamper, write=FRegInfoTamper};
  160.     __property Classes::TNotifyEvent OnRegister = {read=FRegister, write=FRegister};
  161.     __property Classes::TNotifyEvent OnRegWriteErr = {read=FRegWriteErr, write=FRegWriteErr};
  162.     __property Classes::TNotifyEvent OnRegInfoChanged = {read=FRegInfoChanged, write=FRegInfoChanged};
  163.     __property Classes::TNotifyEvent OnReminder = {read=FReminder, write=FReminder};
  164.     __property Classes::TNotifyEvent OnWrongUnlockCode = {read=FWrongUnlockCode, write=FWrongUnlockCode
  165.         };
  166.     __property Classes::TNotifyEvent OnTimedOut = {read=FTimedOut, write=FTimedOut};
  167. };
  168.  
  169. //-- var, const, procedure ---------------------------------------------------
  170. extern PACKAGE void __fastcall Register(void);
  171.  
  172. }    /* namespace Slock */
  173. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  174. using namespace Slock;
  175. #endif
  176. //-- end unit ----------------------------------------------------------------
  177. #endif    // Slock
  178.